<template>
    <view style="padding: 10px 20px;">
        <img src="" style="width: 100%; height:300upx;background:#f0f0f0">
        <view style="margin-bottom: 20upx;">
            <u-search placeholder="请输入" v-model="keyword" ></u-search>
        </view>
        <view class="tabSearch">
            <u-subsection :list="list" :current="0"></u-subsection>
        </view>
        
        <uTabs :baseList="tabBasicList" />
       
        <mainList :baseList="topCompanyBasicList" />
       
    </view>
  </template>
  
  <script>
  import mainList from '@/components/mainList/index.vue'
  import uTabs from '@/components/uTabs/index.vue'
  export default {
    components: {
        mainList,
        uTabs
    },
    data() {
      return {
        keyword:'',
        list:['已购','收藏'],
        tabBasicList: [
                {
                    name:'全部'
                },
                {
                    name:'课程'
                },
                {
                    name:'名家专栏'
                },
                {
                    name:'分类图书'
                }
            ],
        topCompanyBasicList: [
                {
                    id: 0,
                    title: '2024年度全球独角兽企业500强大会',
                    desc: '企业简介企业简介企业简介',
                    tag: '企业标签',
                    slot: ''
                },
                {
                    id: 1,
                    title: '2024年度全球独角兽企业500强大会',
                    desc: '企业简介企业简介企业简介',
                    tag: '企业标签',
                    slot: ''
                },
                {
                    id: 2,
                    title: '2024年度全球独角兽企业500强大会',
                    desc: '企业简介企业简介企业简介',
                    tag: '企业标签',
                    slot: ''
                }
            ],
      }
    },
    onShow() {
        this.getType()
        this.getList()
    },
    methods: {
        async getType () {
            const res = await this.$api.getReadingType({})
            this.tabBasicList = res?.map((item) => {
                return{
                    ...item,
                    name:item.title || item.typename
                }
            })
        },
        async getList () {
            const res = await this.$api.getReading({})
            this.tabBasicList = res?.map((item) => {
                return{
                    ...item,
                    name:item.title || item.typename
                }
            })
        },
        handleEnter(){
            uni.navigateTo({
                url:'/pages/company/enter'
            })
        }
    }
  }
  </script>
  
  <style scoped lang="scss">
  .tabSearch{
    width: 30%;
    padding-bottom: 20upx;
    border-bottom: 1px dashed #f0f0f0;
  }
  </style>
  